package Design_patterns.creator_mode.prototype.demo3;

/**
 * @description: 原型模式深拷贝
 **/

public class CitationTest {
    public static void main(String[] args) throws CloneNotSupportedException {
        //创建原型对象
        Citation citation = new Citation();

        Student student = new Student();
        student.setName("张三");

        citation.setStudent(student);

        //克隆对象
        Citation clone = citation.clone();
        clone.getStudent().setName("李四");


        citation.show();
        clone.show();
        /*
        同学：李四在2020学年第一学期中表现优秀，被评为三好学生，特发此状
        同学：李四在2020学年第一学期中表现优秀，被评为三好学生，特发此状

         */
    }
}
